package com.dinzeer.godfox.event;

import com.dinzeer.godfox.regsiter.GBItemRegsitry;
import mods.flammpfeil.slashblade.capability.slashblade.ISlashBladeState;
import mods.flammpfeil.slashblade.event.SlashBladeEvent;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber
public class TheBloodTearLoot {
    @SubscribeEvent
    public static void BladeStandAttack(SlashBladeEvent.BladeStandAttackEvent event) {
        ISlashBladeState state=event.getSlashBladeState();
         if (state.getTranslationKey().equals("item.godfox.rustgodfox")){
             if (state.getKillCount()>500){
                 if (event.getDamageSource().getEntity() instanceof Player player){
                     if (player.getMainHandItem().getItem() == GBItemRegsitry.tearfluorite.get()){
                         player.addItem(GBItemRegsitry.the_blood_tear.get().getDefaultInstance());
                         player.getMainHandItem().shrink(1);
                         state.setKillCount(state.getKillCount()-500);
                         event.setCanceled(true);
                     }
                 }
             }
         }
    }
}
